A microkernel operating system structure, which has developed since the late 1980s of the 20th century, is quite applicable to a distributed system environment because it effectively supports running of multiprocessors. A microkernel is an operating system kernel that can provide necessary services, where the necessary services include tasks, threads, inter process communication (IPC), memory management, and the like. All services (including device drive) of the microkernel run in user mode, processing the services is the same as processing other programs, and each service runs in its address space; therefore, the services are protected from each other.
FIG. 1 is a schematic diagram of a microkernel operating system based on a client/server model in the prior art. In FIG. 2, both a user process and a system service are connected to a microkernel. When a user needs to request a system service, the user first sends, using the user process, request information 1 for requesting a system service to the microkernel; the microkernel responds 2 to the received request information, and schedules a system service process corresponding to the request information; after processing the request from the user, the system service sends a message 3 to a kernel; and finally, the kernel responds 4 to the received message, and schedules the user process that previously needs to request the system service.
In a manycore architecture, multiple microkernel instances simultaneously exist, one independent microkernel instance runs on each central processing unit (CPU), and each process in user mode can be randomly placed on the microkernel instances for running. Therefore, a user process and a system service process may not run on a same microkernel, and in this case, an IPC inter-manycore communications mechanism needs to be used for information exchange between the user process and the system service process.
FIG. 3 is a schematic diagram of communication interaction between a user process and a system service process in a manycore architecture in the prior art. As shown in FIG. 3, for IPC inter-manycore communication, an agent service monitor needs to run on each microkernel. The Monitor is responsible for managing a data structure of the microkernel, and coordinating intra-manycore communication and inter-manycore communication. In addition, after a system is started, all Monitors in the system are fully connected, that is, every two Monitors are connected. Moreover, each Monitor uses an array to maintain a service list on a microkernel on which the Monitor runs, and provides a global unique identifier for each service in the system.
When requesting a service, a user process first sends a message 1 to a microkernel, the microkernel schedules 2 running of a Monitor, and the Monitor determines, according to content of the message, whether a system service requested by a user is on a same microkernel; and if the system service requested by the user is not on the same microkernel, processing is performed according to FIG. 3, that is, a local Monitor sends a message 3 to a Monitor on a microkernel on which the requested system service is located, where message communication in this procedure uses an IPC inter-manycore communications mechanism. Then a remote Monitor sends a message 4 to a microkernel on which the remote Monitor is located, and the microkernel schedules 5 a target service process. After processing the message, a target service sends a message 6 to the microkernel, the microkernel schedules 7 a Monitor, the Monitor sends, by means of IPC inter-manycore communication, the message 8 to a Monitor on a microkernel on which the required system service is located, the Monitor then sends the message 9 to the microkernel, and finally, the microkernel schedules 10 the user process. In this way, a procedure of scheduling, by means of a request and a response, a user process and a service process that are not on a same microkernel is completed.
As can be seen from FIG. 2, when a user process and a system service process are both on a same microkernel, a context switch needs to be performed at least four times, that is, a message exchange procedure needs to be performed at least four times.
FIG. 3 is another schematic diagram of communication interaction between a user process and a system service process in a manycore architecture in the prior art. FIG. 3 shows that, when a user process and a system service process are not on a same microkernel, a context switch needs to be performed at least eight times and IPC inter-manycore communication needs to be performed at least twice. If the system service process cannot process a user process request and needs to call another service, the context switch and the inter-manycore communication each need to be performed more times. However, in an early monolithic kernel (Mono Kernel) operating system, a context switch needs to be performed only twice.
Therefore, the prior art has a problem that in a manycore architecture of a microkernel, communication between a user process and a system service process needs multiple context switches, and efficiency of a microkernel operating system is relatively low.